<?php

	error_reporting(0);
	session_start();
	
	if ( !$_SESSION['username'] )
	{		
		header ("Location: /index.php?event=badlogin");
		exit;
	}

	if (!$_SESSION['destuser'])
	{
		session_unregister('destuser');
		session_register('destuser');
		
		$_SESSION['destuser'] = $_SESSION['username'];
	}
	
	if ($_GET['user'])
	{	$destuser = $_GET['user'];
	} else {
		$destuser = $_SESSION['destuser'];	}
	
	if ($destuser) // if destuser was set in the URL
	{
		session_unregister('destuser');
		session_register('destuser');
		
		$_SESSION['destuser'] = $destuser; // set session variable to the destination user
	}

	error_reporting(1);

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">


<html>
	<head>
		<title>The Pin Project.</title>
		<link rel="icon" type="image/ico" href="../favicon.ico" />
		<link rel="stylesheet" type="text/css" href="frame.css" />
		<link rel="stylesheet" type="text/css" href="profile.css" />
		
	</head>
	
	<body>
		<div class="wrapper">
			<div class="top">
				<a href="/"><img src="images/logo.png" border=0/></a>
				<div class="headlabel">
					<a href="frame.php?page=profile">Members</a>		
				</div>
			</div>
			
			<div class="side">
			
				<div class="subhead">
					Toolbox
				</div>
				
				<div class="button">
					<img src="/img/arrow_red.gif" /> &nbsp; <a href="logout.php">Log out</a>
				</div>
				<div class="button">
					<img src="/img/arrow_blue.gif"/> &nbsp; <a href="/frame.php?page=home.php">Home</a>
				</div>
				
				<div class="horizontal_separation"></div>
				<div class="horizontal_separation"></div>
				
				<div class="button">
					<img src="/img/icons/viewusers_sm.png" /> &nbsp; <a href="frame.php?page=viewusers">View Users</a>				
				</div>
				<div class="button">
					<img src="/img/icons/tagged_users_sm.png" /> &nbsp; <a href="frame.php?page=taggedusers">My Tagged Users</a>				
				</div>
				
				<div class="horizontal_separation"></div>
				<div class="horizontal_separation"></div>
				
				<div class="button">
					<img src="/img/icons/inbox_sm.png" /> &nbsp; <a href="frame.php?page=inbox">My Inbox</a>
				</div>
				<div class="button">
					<img src="/img/icons/outbox_sm.png" /> &nbsp; <a href="frame.php?page=outbox">My Sent Items</a>				
				</div>
				<div class="button">
					<img src="/img/icons/editprofile_sm.png" /> &nbsp; <a href="frame.php?page=editProfile">Edit Profile</a>				
				</div>
				<div class="button">
					<img src="/img/icons/privacy_sm.png" /> &nbsp; <a href="frame.php?page=privacy">Privacy Settings</a>				
				</div>
				<div class="button">
					<img src="/img/icons/upload_sm.png" /> &nbsp; <a href="frame.php?page=uploadcontent">Add Content</a>				
				</div>
				<div class="button">
					<img src="/img/icons/myuploads_sm.png"/> &nbsp; <a href="frame.php?page=myuploads">My Content</a>				
				</div>
				
				<div class="horizontal_separation"></div>
				<div class="horizontal_separation"></div>
				
				<div class="searchbar">
					Search: <img src="/img/user_incoming_tag.png" /><img src="/img/icons/song_sm.png" /><img src="/img/icons/picture_sm.png" /><img src="/img/icons/entry_sm.png" />
					<br /><input class="inputField" type="text" size="12" id="searchfield" onkeyup="Search();" value=""/>				
				</div>

				<div id="searchresults" class="small" style="width: 100%px; height: 300px; overflow: auto;">
				</div>
				
			</div>	
			
			<div class="mainarea">
				<?php include $_GET['page'] . ".php"; ?>
			</div>
			
		</div>	
	
	</body>
</html>


<script type="text/javascript">
	
	function Search()
	{
		searchField = document.getElementById('searchfield');

		<?php include "../common/ajax_init.php" ?>
          
		request.open("POST", 'do_action.php?actionname=search', true);
		
		request.onreadystatechange = function()
		{
			if(request.readyState == 4)
			{
				var responseText = request.responseText;
				document.getElementById('searchresults').innerHTML = responseText;
			}
		}

		request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		request.send('query=' + searchField.value); 

     }
     
	
</script>

<?php
error_reporting(0);
 $pinSQL->Close(); 
 error_reporting(1);
 ?>